package com.cctc.demo.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cctc.demo.dao.ProductDao;
import com.cctc.demo.domain.Product;
import com.cctc.demo.services.ProductService;
import com.danga.MemCached.MemCachedClient;

@Service("productService")
public class ProductServicesImpl implements ProductService<Product>
{
    
    @Autowired
    private ProductDao<Product> productDao;
    
    //    @Autowired
    //    private MemCachedClient memCachedClient;
    
    @Override
    public List<?> getAllProduct(int start, int end)
    {
        //        List<?> list = (List<?>) memCachedClient.get("1234");
        //        if (list == null)
        //        {
        //            list = 
        return productDao.getAllProduct(start, end);
        //            memCachedClient.add("1234", list);
        //        }
        //        return list;
    }
    
    @Override
    public int getAllProductCount()
    {
        
//        int i = (Integer) memCachedClient.get("12345");
//        if (i == 0)
//        {
           return  productDao.getProductCount();
//            memCachedClient.add("12345", i);
//        }
//        return i;
    }
    
}
